import pandas as pd
list_nodes = [
    {'name':'贾母','category':'第一代'},
    {'name':'贾赦','category':'第二代'},
    {'name':'贾政','category':'第二代'},
    {'name':'王夫人','category':'第二代'},
    {'name':'邢夫人','category':'第二代'},
    {'name':'贾宝玉','category':'第三代'},
    {'name':'林黛玉','category':'第三代'},
    {'name':'薛宝钗','category':'第三代'}
]
list_links = [
    {'source':'贾母','target':'贾赦','value':'母子'},
    {'source':'贾母','target':'贾政','value':'母子'},
    {'source':'贾母','target':'贾宝玉','value':'祖孙'},
    {'source':'贾母','target':'林黛玉','value':'外祖孙'},
    {'source':'贾政','target':'王夫人','value':'夫妻'},
    {'source':'贾赦','target':'邢夫人','value':'夫妻'},
    {'source':'贾赦','target':'贾政','value':'兄弟'},
    {'source':'贾政','target':'贾宝玉','value':'父子'},
    {'source':'贾政','target':'林黛玉','value':'舅甥'},
    {'source':'贾赦','target':'林黛玉','value':'舅甥'},
    {'source':'王夫人','target':'薛宝钗','value':'姨甥'},
    {'source':'邢夫人','target':'王夫人','value':'妯娌'},
    {'source':'王夫人','target':'贾宝玉','value':'母子'},
    {'source':'贾宝玉','target':'林黛玉','value':'表兄妹'},
    {'source':'薛宝钗','target':'贾宝玉','value':'表姐弟'}
]
list_categorys = [
    {'name':'第一代','symbolSize':50},
    {'name':'第二代','symbolSize':40},
    {'name':'第三代','symbolSize':30}
]
sheets=['sheet1','sheet2','sheet3']
dataframs=[pd.DataFrame(lst) for lst in [list_nodes,list_links,list_categorys]]
with pd.ExcelWriter('红楼梦部分人物关系.xlsx') as writer:
    for df,sheet_name in zip(dataframs,sheets):
        df.to_excel(writer,sheet_name=sheet_name,index=False)